#ifndef COMMONTYPES_H
#define COMMONTYPES_H

#include <QtOpenGL>
#include <QString>
#include <QPixmap>

typedef struct
{
    float u;
    float v;
}uvcord;

struct vec3
{
    float x;
    float y;
    float z;

    bool operator<(const vec3 that) const
    {
        return memcmp((void*)this, (void*)&that, sizeof(vec3))>0;
    };
};

struct intercolor
{
    float r;
    float g;
    float b;
    float a;
    float t;
};

typedef struct
{
    float r, g, b, a;
}
color32bit;

typedef struct
{
    QString name;
    QString url;
    QString extension;
    double size;
    int height, width;
    int MaxH, OptimalH, MinH;
    QPixmap pixmap;
}
MetaTexture;

struct particle
{
    float color[4];
    float pos[3];
    float sourcepos[3];
    float dir[3];
    float size[3];
    int timetolive;
    int timeleft;
    float speed;
};

typedef struct
{
    float x;
    float y;
}
vec2;

typedef struct
{
    float x;
    float y;
    float z;
    float w;
}
vec4;

typedef struct
{
    vec3 origin;
    vec3 direction;
}
normal;

typedef struct
{
    vec3 vertices[8];
    unsigned short int values[8];
}
MarchingCube;


// Self explanatory!
typedef struct
{
    vec3 corners[8];
}
BoundingBox;

// Una estructura para manejar las texturas en OpenGL
typedef struct
{
    GLuint TSampler;
    GLuint THandler;
    QString TUrl;
}
TextureBox;

#define tpi 6.283185307
#define pi 3.1415926535
#define pih 1.5707963267

#endif // COMMONTYPES_H
